package cmd

import (
	"fmt"
	"mysql-read-excel/config"
	"mysql-read-excel/mysql"
	"mysql-read-excel/utils"
	"os"
)

func InitConfigAndDB() {
	//启动类加载的路径
	mainLoadPath, _ := os.Getwd()
	fmt.Println(mainLoadPath)
	//加载配置文件
	err := config.ReadConfig("config/config.yaml")
	if err != nil {
		fmt.Println("ReadConfig, config.yaml ERROR,", err)
		panic(err)
	}
	fmt.Println("init SystemConfig=", utils.StructToJson(config.SystemConfig))

	//初始化数据库
	err = mysql.InitializeDatabase()
	if err != nil {
		fmt.Println("ReadConfig, config.yaml ERROR,", err)
		panic(err)
	}
}
